<style>
    #container{
        padding: 0px;
        border-radius:0px;
        border-width:0px;
    }
</style>
<form class="layui-form seller-alone-form" action="" method="post">

    <div class="layui-form-item">
        <label class="layui-form-label"><i class="required-color">*</i>选择分类：</label>
        <div class="layui-input-inline seller-inline-5">
            <select name="type_id" id="type" lay-verify="required" style="z-index: 5">
                <option value="">请选择文章分类</option>
                {volist name='list' id='vo'}
                <option value="{$vo.id}">{$vo.type_name}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"><i class="required-color">*</i>文章标题：</label>
        <div class="layui-input-inline seller-inline-5">
            <input type="text" name="title" required  lay-verify="required" placeholder="请输入文章标题" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label"><i class="required-color">*</i>简介：</label>
        <div class="layui-input-inline">
            <textarea name="brief" required lay-verify="required" placeholder="请输入简介" class="layui-textarea" style="width:500px;"></textarea>
        </div>
    </div>
    <br>

    <div class="layui-form-item">
        <label class="layui-form-label"><i class="required-color">*</i>封面图：</label>
        <div class="layui-input-inline seller-inline-5">
            {shop:image id='img' name='cover' required lay-verify='required'/}
        </div>
    </div>

    <div class="layui-form-item layui-form-text" >
        <label class="layui-form-label"><i class="required-color">*</i>文章内容：</label>
        <div class="layui-input-block" style="z-index: 1">
            <textarea id="container" name="content" style="width:100%;height:300px;" type="text/plain" required  lay-verify="required" class="layui-textarea"></textarea>
        </div>
    </div>

    <div class="layui-form-item" style="margin: 20px;">
        <label class="layui-form-label">是否发布：</label>
        <div class="layui-input-block">
            <input type="radio" name="is_pub" value="1" title="立即发布" checked>
            <input type="radio" name="is_pub" value="2" title="暂不发布">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">排序：</label>
        <div class="layui-input-block seller-inline-2">
            <input type="text" name="sort" required  lay-verify="required" value="100" placeholder="从小到大排列" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            {:shopToken()}
            <button type="button" class="layui-btn" lay-submit lay-filter="add_article">保存</button>
            <button onclick="javascript:history.back(-1);" type="reset" class="layui-btn layui-btn-primary">返回</button>
        </div>
    </div>

</form>

<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(add_article)', function(data){
            JsPost("{:url('Article/add')}", data.field, function(res){
                if(res.status){
                    layer.msg(res.msg, {time: 1300},function(){
                        window.location.href = "{:url('Article/index')}";
                    });
                }else{
                    layer.msg(res.msg);
                }
            })
        });
    });
</script>

<script type="text/javascript">
    var ue = UE.getEditor('container');
</script>